/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ve.com.cantv.worktables.ejb.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Ghust
 */
@Entity
@Table(name = "module")
@NamedQueries({@NamedQuery(name = "Module.findAll", query = "SELECT m FROM Module m"), @NamedQuery(name = "Module.findByIdmodule", query = "SELECT m FROM Module m WHERE m.idmodule = :idmodule"), @NamedQuery(name = "Module.findByName", query = "SELECT m FROM Module m WHERE m.name = :name"), @NamedQuery(name = "Module.findByDatechange", query = "SELECT m FROM Module m WHERE m.datechange = :datechange"), @NamedQuery(name = "Module.findByIdmodulepadre", query = "SELECT m FROM Module m WHERE m.idmodulepadre = :idmodulepadre"), @NamedQuery(name = "Module.findByPage", query = "SELECT m FROM Module m WHERE m.page = :page")})
public class Module implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idmodule")
    private Integer idmodule;
    @Column(name = "name")
    private String name;
    @Column(name = "datechange")
    @Temporal(TemporalType.DATE)
    private Date datechange;
    @Column(name = "idmodulepadre")
    private Integer idmodulepadre;
    @Column(name = "page")
    private String page;
    @JoinColumn(name = "iduser", referencedColumnName = "iduser")
    @ManyToOne
    private UUser iduser;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "module")
    private Collection<Rolmodule> rolmoduleCollection;

    public Module() {
    }

    public Module(Integer idmodule) {
        this.idmodule = idmodule;
    }

    public Integer getIdmodule() {
        return idmodule;
    }

    public void setIdmodule(Integer idmodule) {
        this.idmodule = idmodule;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getDatechange() {
        return datechange;
    }

    public void setDatechange(Date datechange) {
        this.datechange = datechange;
    }

    public Integer getIdmodulepadre() {
        return idmodulepadre;
    }

    public void setIdmodulepadre(Integer idmodulepadre) {
        this.idmodulepadre = idmodulepadre;
    }

    public String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

    public UUser getIduser() {
        return iduser;
    }

    public void setIduser(UUser iduser) {
        this.iduser = iduser;
    }

    public Collection<Rolmodule> getRolmoduleCollection() {
        return rolmoduleCollection;
    }

    public void setRolmoduleCollection(Collection<Rolmodule> rolmoduleCollection) {
        this.rolmoduleCollection = rolmoduleCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idmodule != null ? idmodule.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Module)) {
            return false;
        }
        Module other = (Module) object;
        if ((this.idmodule == null && other.idmodule != null) || (this.idmodule != null && !this.idmodule.equals(other.idmodule))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ve.com.cantv.worktables.ejb.entity.Module[idmodule=" + idmodule + "]";
    }

}
